Powershell 检测USB存储设备 |
您所在的位置:网站首页 › shell u盘 › Powershell 检测USB存储设备 |
1.查看存储设备信息
1.1 Win32_LogicalDisk 获取本机逻辑磁盘(计算机中显示的盘符 C: D: E:等),包括硬盘,光驱,U盘等设备
Get-WmiObject -Class Win32_LogicalDisk
运行结果
DeviceID --> 盘符
DriveType --> 设备类型
VolumeName --> 卷标
DeviceID : C:
DriveType : 3
ProviderName :
FreeSpace : 25028714496
Size : 232373874688
VolumeName : OS
DeviceID : D:
DriveType : 3
ProviderName :
FreeSpace : 8898105344
Size : 9751752704
VolumeName : 新加卷
DeviceID : F:
DriveType : 5
ProviderName :
FreeSpace :
Size :
VolumeName :
使用 Select * 查看全部信息
eg. $a=Get-WmiObject -Class Win32_LogicalDisk $a[0] | Select * 1.2 Win32_DiskDrive 获取本机物理磁盘信息 Get-WmiObject -Class Win32_DiskDrive 1.3 Win32_PnPEntity获取本机USB设备信息 Get-WmiObject -Class Win32_PnPEntity | Where-Object { $_.DeviceID -like 'USBSTOR*' }可以查看 Powershell 检查设备管理器 Get-WmiObject -Class Win32_PnPEntity 可查本机所有设备 2. Compare-Object 比较差异alias(别名): compare diff $a=Compare-Object (1,2,3) (1,2,4) $a InputObject SideIndicator ----------- ------------- 4 => 3 |
今日新闻 |
点击排行 |
|
推荐新闻 |
图片新闻 |
|
专题文章 |
CopyRight 2018-2019 实验室设备网 版权所有 win10的实时保护怎么永久关闭 |